import React, { Component } from 'react'

import './index.scss'
export default class MyMap extends Component {
  componentDidMount() {
    var map = new window.BMap.Map("container");
    var point = new window.BMap.Point(116.404, 39.915);
    map.centerAndZoom(point, 15);


    // function myFun(result) {
    //   var cityName = result.name;
    //   map.setCenter(cityName);
    //   alert("当前定位城市:" + cityName);
    // }
    var myCity = new window.BMap.LocalCity();
    myCity.get(res => {
      var cityName = res.name;
      alert(cityName);
    });
  }
  render() {
    return (
      <div className='content'>
        <div className='my_map'>
          <div id="container"></div>
        </div>
      </div>
    )
  }
}
